package com.poker.common.config;

import com.poker.common.interception.LoginInterception;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {

    @Resource
    LoginInterception loginInterception;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterception)
                .addPathPatterns("/**")
                .excludePathPatterns(
                        "/login",
                        "/logout/**",

                        "/getAllEbook",
                        "/deleteEbook/**",
                        "/saveEbook",

                        "/getAllCategory",
                        "/deleteCategory/**",
                        "/saveCategory",

                        "/getAllDoc/**",
                        "/getDocByEbookId",
                        "/deleteDoc/**",
                        "/saveDoc",
                        "/findContent/**",
                        "/docVote",
                        "/docVoteStatus",

                        "/getAllUser",
                        "/saveUser",
                        "/deleteUser/**",

                        "/getStatistic",
                        "/get30DStatistic"

                );
    }
}
